import redis
import logging

class Config(object):

    SQLALCHEMY_DATABASE_URI = 'mysql://root:mysql@127.0.0.1/information09'
    SQLALCHEMY_TRACK_MODIFICATIONS = False

    # 配置redis
    REDIS_HOST = '127.0.0.1'
    REDIS_PORT = 6379

    SECRET_KEY = 'asTFeAXtNhXNii7kwWzNlH/W7G84rHYC8YEeAAo0eJo='

    # 配置redis
    SESSION_TYPE = 'redis'
    SESSION_REDIS = redis.StrictRedis(host=REDIS_HOST, port=REDIS_PORT)
    SESSION_USE_SIGNER = True # 开启签名，保证数据安全
    PERMANENT_SESSION_LIFETIME = 86400 * 7  # 配置过期时间


class DevelopmentConfig(Config):
    """开发模式下设置"""
    DEBUG = True
    LOG_LEVEL = logging.DEBUG


class ProductionConfig(Config):
    """开发模式下设置"""
    DEBUG = False
    LOG_LEVEL = logging.WARNING